#!/bin/sh -f
# $Id: test.sh 3f30a0319063 2012/09/24 01:09:29 pgurumur $
# Copyright (c) 2012 Prabhu Gurumurthy <pgurumur@gmail.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
# File test.sh generated on Saturday September 22, 2012 @ 16:27:13 PDT
#

# __version__  = "$Revision: 3f30a0319063 $"
# __author__   = "$Author: pgurumur $"
# __modified__ = "$Date: 2012-09-24 01:09:29Z $"

MACHINE=`uname`
INSTALL="sudo install -C -c"
INSDIR=
if [ ${MACHINE} = "Linux" -o ${MACHINE} = "OpenBSD" ]; then
   INSDIR="/opt/local"
elif [ ${MACHINE} = "Darwin" ]; then
   INSDIR="/usr/local"
fi

BINDIR="${INSDIR}/bin"
ETCDIR="${INSDIR}/etc"

${INSTALL} -m 0555 -o root -g wheel vivault ${BINDIR}/vivault
if [ ! -d ${ETCDIR} ]; then
   sudo mkdir -p ${ETCDIR}
fi

${INSTALL} -m 0440 -o root -g wheel vivault.conf ${ETCDIR}/vivault.conf
${INSTALL} -m 0555 -o root -g wheel googleauth.py ${BINDIR}/googleauth.py
${INSTALL} -m 0400 -o root -g wheel vaultedfile ${ETCDIR}/filevault

[ -f ${BINDIR}/vivault ] && echo "vivault installed under ${BINDIR}"
[ -f ${ETCDIR}/vivault.conf ] && echo "vivault.conf installed under ${ETCDIR}"
[ -f ${BINDIR}/googleauth.py ] && echo "googleauth.py installed under ${BINDIR}"
[ -f ${ETCDIR}/filevault ] && echo "filevault installed under ${ETCDIR}"
